package com.learn.sb.rabbitmq.queue;

import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

// Spring Boot 根据配置自动在RabbitMQ中创建队列
@Configuration
public class AutoCreateQueue {

    @Value("${rabbitmq.queue.msg}")
    private String msgQueueName = null;
    @Value("${rabbitmq.queue.user}")
    private String userQueueName = null;

    @Bean
    public Queue createQueueMsg() {
        return new Queue(msgQueueName, true);
    }

    @Bean
    public Queue createQueueUser() {
        return new Queue(userQueueName, true);
    }
}
